# Incidence plots for Kargar and Mann
using Plots, LaTeXStrings, Parameters
pyplot()

# State variables
@with_kw struct KM
	β::Float64=0.5
	θ::Float64=0.5
end

# Incidence
function Inc(m::KM)
    return (1-m.β)/(1-(1-m.θ)*(1-m.β))
end

# Fraction of total surplus captured by students
function Incident(m::KM)
    return 1/(1+1/Inc(m))
end


β_range = 0:0.01:1
θ_range = 0:0.01:1
mm1 = [KM(β = β, θ = 0.4) for β in β_range]

plot(β_range, Incident.(mm1), l = 1.5, foreground_color_legend = :transparent, 
	background_color_legend = :transparent, leg = :topright, label=false,
	xlabel = L"\beta", ylabel = L"\frac{I}{I+1}", 
	xtickfontsize=12,ytickfontsize=12,xguidefontsize=12, yguidefontsize=12,
	foreground_color_grid = :lightgray,
	fontfamily = "serif",
	title ="Fraction of subsidies captured by students")

ylims!((0,1))
savefig("./Figures/subsidy_fraction.eps")
